<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserLevelTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_level', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name',60)->comment('等级名称');
            $table->unsignedInteger('min_point',false)->nullable()->default(0)->comment('累计积分下限');
            $table->unsignedInteger('max_point',false)->nullable()->default(0)->comment('累计积分上限');
            $table->unsignedInteger('buy_money',false)->default(0)->comment('消费金额');
            $table->unsignedDecimal('discount',5,2)->default(0)->comment('折扣');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_level');
    }
}
